package com.rockxin.cat.activity;

import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.rockxin.cat.R;
import com.rockxin.cat.base.AppManager;
import com.rockxin.cat.base.BaseActivity;
import com.rockxin.cat.event.JumpIndexEvent;

import org.simple.eventbus.EventBus;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by cat on 18-3-1.
 * 提现成功
 */

public class WithdrawalsSuccessActivity extends BaseActivity {

    @BindView(R.id.back_img)
    ImageView backImg;
    @BindView(R.id.title)
    TextView title;
    @BindView(R.id.tv_withdrawals)
    TextView tvWithdrawals;
    @BindView(R.id.tv_poundage)
    TextView tvPoundage;
    @BindView(R.id.btn_return_my)
    Button btnReturnMy;
    @BindView(R.id.btn_return_home)
    Button btnReturnHome;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
        super.onCreate(savedInstanceState, persistentState);
    }

    @Override
    protected int setLayout() {
        return R.layout.activity_withdrawals_success;
    }

    @Override
    public void initData() {
        initView();
        setListener();
        getData();
    }

    private void initView() {
        title.setText("提现");
    }

    private void setListener() {
        backImg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }

    private void getData() {
        final String fee = getIntent().getStringExtra("fee");
        final String money = getIntent().getStringExtra("money");
        tvPoundage.setText(fee);
        tvWithdrawals.setText(money);
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        finish();
    }

    @OnClick({R.id.back_img, R.id.btn_return_my, R.id.btn_return_home})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.back_img:
                finish();
                break;
            case R.id.btn_return_my:
                AppManager.getInstance().killActivity(DepositActivity.class);
                finish();
                break;
            case R.id.btn_return_home:
                AppManager.getInstance().killActivity(DepositActivity.class);
                EventBus.getDefault().post(new JumpIndexEvent(0));
                finish();
                break;
        }
    }
}
